Expression = case_when(logFC > 0.5 & FDR < 0.05 ~ "Up-regulated",
logFC < -0.5 & FDR < 0.05 ~ "Down-regulated",
TRUE ~ "Unchanged")
)
head(data) %>%
kable()
#save list of unfiltered DEGs
#write.csv(data, file=paste0("unfiltered_DEGs_", j,".csv"))
#get DEGs
#data <- data[data$Expression != "Unchanged", ]
#save list of unfiltered DEGs
#write.csv(data, file=paste0("DEGs_0.5_LFC_", j,".csv"))
# check if number of up/down genes match previous
# print(d)
#up_down <- data %>%
#count(Expression) %>%
#  kable()
#  print(up_down)
# print(dge_sum)
#
# count(data$Expression)
# plot volcano plot with up and downregulated genes coloured
p2 <- ggplot(data, aes(logFC, -log(FDR,10))) +
geom_point(aes(color = Expression), size = 2/5) +
xlab(expression("log"[2]*"FC")) +
ylab(expression("-log"[10]*"FDR")) +
scale_color_manual(values = c("dodgerblue3", "gray50", "firebrick3")) +
guides(colour = guide_legend(override.aes = list(size=1.5)))
# print(p2)
# add colour by significance
data <- data %>%
mutate(
Significance = case_when(
abs(logFC) >= 1 & FDR <= 0.05 & FDR > 0.01 ~ "FDR 0.05",
abs(logFC) >= 1 & FDR <= 0.01 & FDR > 0.001 ~ "FDR 0.01",
abs(logFC) >= 1 & FDR <= 0.001 ~ "FDR 0.001",
TRUE ~ "Unchanged")
)
head(data) %>%
kable()
##### vol plot for colour with significane ############
p3 <- ggplot(data, aes(logFC, -log(FDR,10))) +
geom_point(aes(color = Significance), size = 2/5) +
xlab(expression("log"[2]*"FC")) +
ylab(expression("-log"[10]*"FDR")) +
scale_color_viridis_d() +
guides(colour = guide_legend(override.aes = list(size=1.5))) +
ggtitle(filenames[[i]])
# print(p3)
top <- 10
top_genes <- bind_rows(
data %>%
filter(Expression == 'Up-regulated') %>%
arrange(FDR, desc(abs(logFC))) %>%
head(top),
data %>%
filter(Expression == 'Down-regulated') %>%
arrange(FDR, desc(abs(logFC))) %>%
head(top)
)
top_genes %>%
kable()
p3 <-  p3 +
geom_label_repel(data = top_genes, label.size = 0.5, force = 0.5, max.overlaps = 15,
mapping = aes(logFC, -log(FDR,10), label = row.names(top_genes)),
size = 5)
print(p3)
############# vol plot for highlighting specific genes  in gene_list ############
#chnage name of data to make it easier to identify which is your data ###############
#add expression
vol_plot_data <- data %>%
mutate(
Expression = case_when(logFC > 1 & FDR < 0.05 ~ "Up-regulated",
logFC < -1 & FDR < 0.05 ~ "Down-regulated",
TRUE ~ "Unchanged")
)
head(data) %>%
kable()
# Add colour, size and alpha (transparency) to volcano plot --------------------
cols <- c("Up-regulated" = "#ffad73", "Down-regulated" = "#26b3ff", "Unchanged" = "grey")
sizes <- c("Up-regulated" = 2, "Down-regulated" = 2, "Unchanged" = 1)
alphas <- c("Up-regulated" = 1, "Down-regulated" = 1, "Unchanged" = 0.5)
# create gene list of genes to highlist
gene_list <- c("APOBEC3B")
# gene_list <- read.csv("hub_genes_grey60_0.7.csv")
# gene_list <- gene_list$x
# gene_list <- filtered_hub_genes_HD
#gene_list <- c("DDX1")
#subset data selecting for genes in genelist
ils <- vol_plot_data[row.names(vol_plot_data) %in% gene_list,]
#plot vol plot highlighting genelist and adding labels
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(0.5), log2(2)),
linetype = "dashed") +
scale_colour_manual(values = cols)+
geom_point(aes(colour = Expression),
alpha = 0.2,
shape = 16,
size = 1)  + geom_point(data = ils, # New layer containing data subset il_genes
size = 2,
shape = 21,
fill = "orange",
colour = "black") +
ggtitle(filenames[[i]]) + geom_label_repel(data = ils, # Add labels last to appear as the top layer
aes(label = row.names(ils)),
force = 2,
nudge_y = 1)
# print(p3)
}
# Add colour, size and alpha (transparency) to volcano plot --------------------
cols <- c("Up-regulated" = "#ffad73", "Down-regulated" = "#26b3ff", "Unchanged" = "grey")
sizes <- c("Up-regulated" = 2, "Down-regulated" = 2, "Unchanged" = 1)
alphas <- c("Up-regulated" = 1, "Down-regulated" = 1, "Unchanged" = 0.5)
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(0.5), log2(2)),
linetype = "dashed") +
scale_colour_manual(values = cols)+
geom_point(aes(colour = Expression),
alpha = 0.2,
shape = 16,
size = 1)  + geom_point(data = ils, # New layer containing data subset il_genes
size = 2,
shape = 21,
fill = "orange",
colour = "black") +
ggtitle(filenames[[i]])
p3
#plot vol plot highlighting genelist and adding labels
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(0.5), log2(2)),
linetype = "dashed") +
scale_colour_manual(values = cols)+
geom_point(aes(colour = Expression),
alpha = 0.2,
shape = 16,
size = 1)
p3
#plot vol plot highlighting genelist and adding labels
p3 <- p3 + geom_point(data = ils, # New layer containing data subset il_genes
size = 2,
shape = 21,
fill = "orange",
colour = "black") +
ggtitle(filenames[[i]]) + geom_label_repel(data = ils, # Add labels last to appear as the top layer
aes(label = row.names(ils)),
force = 2,
nudge_y = 1)
p3
#plot vol plot highlighting genelist and adding labels
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(1), log2(1)),
linetype = "dashed") +
scale_colour_manual(values = cols)+
geom_point(aes(colour = Expression),
alpha = 0.2,
shape = 16,
size = 1)
p3
#plot vol plot highlighting genelist and adding labels
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(2), log2(2)),
linetype = "dashed") +
scale_colour_manual(values = cols)+
geom_point(aes(colour = Expression),
alpha = 0.2,
shape = 16,
size = 1)
# print(p3)
p3
#plot vol plot highlighting genelist and adding labels
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(0.5), log2(2)),
linetype = "dashed") +
scale_colour_manual(values = cols)+
geom_point(aes(colour = Expression),
alpha = 0.2,
shape = 16,
size = 1)
p3
#plot vol plot highlighting genelist and adding labels
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(0.5), log2(2)),
linetype = "dashed") +
geom_point(aes(colour = Expression),
alpha = 0.2,
shape = 16,
size = 1)
p3
help(geom_point)
#plot vol plot highlighting genelist and adding labels
p3 <- ggplot(data = vol_plot_data, # Original data
aes(x = logFC, y = -log(FDR,10))) +
geom_hline(yintercept = -log10(0.05),
linetype = "dashed") +
geom_vline(xintercept = c(log2(0.5), log2(2)),
linetype = "dashed") +
scale_colour_manual(values = cols)+
geom_point(aes(colour = Expression),
shape = 16,
size = 1)
p3
# We estimate the variance for each row in the logcounts matrix
var_genes <- apply(logcounts, 1, var)
head(var_genes)
# Get the gene names for the top 500 most variable genes
select_var <- names(sort(var_genes, decreasing=TRUE))[1:500]
head(select_var)
# Subset logcounts matrix
highly_variable_lcpm <- logcounts[select_var,]
dim(highly_variable_lcpm)
head(highly_variable_lcpm)
## Get some nicer colours
mypalette <- brewer.pal(11, "RdYlBu")
morecols <- colorRampPalette(mypalette)
# Set up colour vector for celltype variable
col.cell <- c( "red", "green",  "cyan",    "purple")[edgeRData$samples$group]
# Plot the heatmap
heatmap.2(highly_variable_lcpm,
col=rev(morecols(50)),
trace="column",
main="Top 500 most variable genes across samples",
ColSideColors=col.cell,scale="row")
#get normalised count matrix
rownames(edgeRData) <- paste0("X", seq_len(nrow(edgeRData)))
edgeRData <- DGEList(counts=counts.keep, genes=rownames(counts.keep), group = treatment)
edgeRData <- calcNormFactors(edgeRData, method="TMM")
CPM <- cpm(edgeRData, log = FALSE)
CPM <- as.matrix(CPM)
scaledata <- t(scale(t(CPM)))
scaledata
setwd("~/RMS RNA seq/Zoes data/DEG lists")
#get list of DEGs for clones C7 and C13
#get list of genes DE in at least one condition
files <- list.files(path = "~/RMS RNA seq/Zoes data/DEG lists", pattern = "RH_C" )
files
#create empty list
my_list <- list()
for (i in files){
#read file
DEGs <- read.csv(i)
#get gene names
genes <- DEGs$X
#append into a list
my_list[[length(my_list) + 1]] <- genes   # Append new list element
}
#merge list
merged.data.frame = Reduce(function(...) merge(..., all=T), my_list)
#remove duplicated gene names
all_DEGs <- merged.data.frame[!duplicated(merged.data.frame$x), ]
all_DEGs <- all_DEGs$x
write.csv(all_DEGs, file = "combined_DEGs_clones.csv")
setwd("~/RMS RNA seq/Zoes data/DEG lists")
genes_of_interest <- read.csv("combined_DEGs_clones.csv")
genes_of_interest
genes_of_interest <- read.csv("combined_DEGs_clones.csv")
genes_of_interest$x
#subset for genes of interest
expression_of_genes_of_interest <- scaledata[row.names(scaledata) %in% genes_of_interest ,]
h1<-Heatmap(as.matrix(expression_of_genes_of_interest[,1:(ncol(expression_of_genes_of_interest))]),cluster_rows=TRUE,cluster_columns=FALSE,use_raster=FALSE,row_dend_reorder = TRUE,show_row_dend = FALSE,column_split=factor(c(rep('RH_C13',6),rep('RH_C7',6),rep('RH_HD',6), rep("RH30_P", 6)),levels=c('RH_C13','RH_C7','RH_HD', 'RH30_P')),show_row_names=TRUE,show_column_names = FALSE, heatmap_legend_param = list(title = "Z-score"))
hlist <- h1
tiff(paste0('hallamrks_immune_only_Hmap_kmeans_k','_clusters.tiff'),width=2000,height=3000,res=300)
draw(hlist,cluster_rows=FALSE, row_dend_reorder = TRUE,show_row_dend = FALSE)
dev.off()
CPM
expression_of_genes_of_interest
genes_of_interest
genes_of_interest <- genes_of_interest$x
#get normalised count matrix
rownames(edgeRData) <- paste0("X", seq_len(nrow(edgeRData)))
edgeRData <- DGEList(counts=counts.keep, genes=rownames(counts.keep), group = treatment)
edgeRData <- calcNormFactors(edgeRData, method="TMM")
CPM <- cpm(edgeRData, log = FALSE)
CPM <- as.matrix(CPM)
scaledata <- t(scale(t(CPM)))
#subset for genes of interest
expression_of_genes_of_interest <- scaledata[row.names(scaledata) %in% genes_of_interest ,]
expression_of_genes_of_interest
h1<-Heatmap(as.matrix(expression_of_genes_of_interest[,1:(ncol(expression_of_genes_of_interest))]),cluster_rows=TRUE,cluster_columns=FALSE,use_raster=FALSE,row_dend_reorder = TRUE,show_row_dend = FALSE,column_split=factor(c(rep('RH_C13',6),rep('RH_C7',6),rep('RH_HD',6), rep("RH30_P", 6)),levels=c('RH_C13','RH_C7','RH_HD', 'RH30_P')),show_row_names=TRUE,show_column_names = FALSE, heatmap_legend_param = list(title = "Z-score"))
hlist <- h1
tiff(paste0('hallamrks_immune_only_Hmap_kmeans_k','_clusters.tiff'),width=2000,height=3000,res=300)
draw(hlist,cluster_rows=FALSE, row_dend_reorder = TRUE,show_row_dend = FALSE)
dev.off()
# We estimate the variance for each row in the logcounts matrix
var_genes <- apply(logcounts, 1, var)
head(var_genes)
# Get the gene names for the top 500 most variable genes
select_var <- names(sort(var_genes, decreasing=TRUE))[1:500]
head(select_var)
# Subset logcounts matrix
highly_variable_lcpm <- logcounts[select_var,]
dim(highly_variable_lcpm)
head(highly_variable_lcpm)
## Get some nicer colours
mypalette <- brewer.pal(11, "RdYlBu")
morecols <- colorRampPalette(mypalette)
# Set up colour vector for celltype variable
col.cell <- c( "red", "green",  "cyan",    "purple")[edgeRData$samples$group]
# Plot the heatmap
heatmap.2(highly_variable_lcpm,
col=rev(morecols(50)),
trace="column",
main="Top 500 most variable genes across samples",
ColSideColors=col.cell,scale="row")
# Save the heatmap
png(file="High_var_genes.heatmap.png")
heatmap.2(highly_variable_lcpm,col=rev(morecols(50)),trace="none", main="Top 500 most variable genes\nacross samples",ColSideColors=col.cell,scale="row")
dev.off()
logcounts
logcounts <- logcounts[,!grepl("HD", colnames(logcounts))]
logcounts
dim(logcounts)
var_genes <- apply(logcounts, 1, var)
head(var_genes)
# Get the gene names for the top 500 most variable genes
select_var <- names(sort(var_genes, decreasing=TRUE))[1:500]
head(select_var)
# Subset logcounts matrix
highly_variable_lcpm <- logcounts[select_var,]
dim(highly_variable_lcpm)
head(highly_variable_lcpm)
sampleID <- colnames(rawData)
treatment <- c()
for (i in 1:ncol(rawData)) {
samplename <- sampleID[i]
group <- if(grepl("RH30_P", samplename)) {print("RH30_P")
}
else if(grepl("RH_C7", samplename)) {print("RH_C7")
} else if(grepl("RH_C13", samplename)) {print("RH_C13")
}
treatment[i] <- group
}
treatment
col.cell <- c( "green",  "cyan",    "purple")[treatment]
col.cell
treatment
logcounts
colnames(logcounts)
# Set up colour vector for celltype variable
col.cell <- c( "green",  "cyan",    "purple")[colnames$logcounts]
# Set up colour vector for celltype variable
col.cell <- c( "green",  "cyan",    "purple")[colnames(logcounts)]
col.cell
colnames(logcounts)
col.cell <- c( "green", "green","green","green","green","green", "cyan",   "cyan",  "cyan",  "cyan",  "cyan",  "cyan",   "purple", "purple", "purple", "purple", "purple", "purple")[colnames(logcounts)]
col.cell
col.cell <- c( "green", "green","green","green","green","green", "cyan",   "cyan",  "cyan",  "cyan",  "cyan",  "cyan",   "purple", "purple", "purple", "purple", "purple", "purple")[treatment]
col.cell
treatment
# Set up colour vector for celltype variable
x <- colnames(logcounts)
col.cell <- c( "green", "green","green","green","green","green", "cyan",   "cyan",  "cyan",  "cyan",  "cyan",  "cyan",   "purple", "purple", "purple", "purple", "purple", "purple")[x]
col.cell
# Set up colour vector for celltype variable
col.cell <- c( "green",  "cyan",   "purple")[x]
# Plot the heatmap
heatmap.2(highly_variable_lcpm,
col=rev(morecols(50)),
trace="column",
main="Top 500 most variable genes across samples",
ColSideColors=col.cell,scale="row")
# Save the heatmap
png(file="High_var_genes.heatmap.png")
heatmap.2(highly_variable_lcpm,col=rev(morecols(50)),trace="none", main="Top 500 most variable genes\nacross samples",ColSideColors=col.cell,scale="row")
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(brewer.pal(9,"RdBu")))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=morecols))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=morecols)
morecols
morecols <- colorRampPalette(mypalette)
morecols
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=morecols)
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(brewer.pal(9,"RdBu")))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(brewer.pal(9,"Pastel1")))
help(brewer.pal)
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(brewer.pal(9,"Set1")))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(brewer.pal(9,"Set2")))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(brewer.pal(9,"Set3")))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(viridis_pal("inferno")))
help(viridis_pal)
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(viridis_pal("A")))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(viridis_pal()(12)))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(viridis_pal()(11)))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(viridis_pal()(11)))
help(viridis_pal)
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(viridis_pal(option = "magma")))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=rev(viridis_pal(option = "magma")))
viridis_pal(option = "magma")
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "magma"))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=scale_fill_viridis(option="magma"))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option="magma"))
viridis_pal
help(scale_fill_viridis(option="magma"))
help(viridis_pal)
show_col(viridis_pal()(12))
show_col(viridis_pal()("A"))
show_col(viridis_pal(option = "A")())
show_col(viridis_pal(option = "A")(12))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "A")(12))
show_col(viridis_pal(option = "A")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "A")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "C")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "D")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "E")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "F")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "G")(4))
help(viridis_pal)
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(4))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(2))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(5))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(12))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(6))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(5))
heatmap(highly_variable_lcpm,
Rowv=NA, Colv=NA, col=viridis_pal(option = "B")(12))
logcounts <- logcounts[,!grepl("HD", colnames(logcounts))]
var_genes <- apply(logcounts, 1, var)
head(var_genes)
# Get the gene names for the top 500 most variable genes
select_var <- names(sort(var_genes, decreasing=TRUE))[1:500]
head(select_var)
# Subset logcounts matrix
highly_variable_lcpm <- logcounts[select_var,]
dim(highly_variable_lcpm)
head(highly_variable_lcpm)
## Get some nicer colours
mypalette <- brewer.pal(11, "RdYlBu")
morecols <- colorRampPalette(mypalette)
# Set up colour vector for celltype variable
col.cell <- c( "green",  "cyan",   "purple")[x]
# Plot the heatmap
heatmap.2(highly_variable_lcpm,
col=rev(morecols(50)),
trace="column",
main="Top 500 most variable genes across samples",
ColSideColors=col.cell,scale="row")
h1<-Heatmap(as.matrix(highly_variable_lcpm[,1:(ncol(highly_variable_lcpm))]),cluster_rows=TRUE,cluster_columns=FALSE,use_raster=FALSE,row_dend_reorder = TRUE,show_row_dend = FALSE,column_split=factor(c(rep('RH_C13',6),rep('RH_C7',6),rep('RH_HD',6), rep("RH30_P", 6)),levels=c('RH_C13','RH_C7','RH_HD', 'RH30_P')),show_row_names=TRUE,show_column_names = FALSE, heatmap_legend_param = list(title = "Z-score"))
h1<-Heatmap(as.matrix(highly_variable_lcpm[,1:(ncol(highly_variable_lcpm))]),cluster_rows=TRUE,cluster_columns=FALSE,use_raster=FALSE,row_dend_reorder = TRUE,show_row_dend = FALSE,column_split=factor(c(rep('RH_C13',6),rep('RH_C7',6), rep("RH30_P", 6)),levels=c('RH_C13','RH_C7','RH_HD', 'RH30_P')),show_row_names=TRUE,show_column_names = FALSE, heatmap_legend_param = list(title = "Z-score"))
hlist <- h1
draw(hlist,cluster_rows=FALSE, row_dend_reorder = TRUE,show_row_dend = FALSE)
hlist
draw(hlist,cluster_rows=FALSE, row_dend_reorder = TRUE,show_row_dend = FALSE)
tiff(paste0('hallamrks_immune_only_Hmap_kmeans_k','_clusters.tiff'),width=2000,height=3000,res=300)
hlist <- h1
tiff(paste0('hallamrks_immune_only_Hmap_kmeans_k','_clusters.tiff'),width=2000,height=3000,res=300)
h1
h1<-Heatmap(as.matrix(highly_variable_lcpm[,1:(ncol(highly_variable_lcpm))]),cluster_rows=TRUE,cluster_columns=FALSE,use_raster=FALSE,row_dend_reorder = TRUE,show_row_dend = FALSE,column_split=factor(c(rep('RH_C13',6),rep('RH_C7',6), rep("RH30_P", 6)),levels=c('RH_C13','RH_C7','RH_HD', 'RH30_P')),show_row_names=TRUE,show_column_names = FALSE, heatmap_legend_param = list(title = "Z-score"))
dev.off()
h1<-Heatmap(as.matrix(highly_variable_lcpm[,1:(ncol(highly_variable_lcpm))]),cluster_rows=TRUE,cluster_columns=TRUE,use_raster=FALSE,row_dend_reorder = TRUE,show_row_dend = FALSE,column_split=factor(c(rep('RH_C13',6),rep('RH_C7',6), rep("RH30_P", 6)),levels=c('RH_C13','RH_C7','RH_HD', 'RH30_P')),show_row_names=TRUE,show_column_names = FALSE, heatmap_legend_param = list(title = "Z-score"))
hlist <- h1
tiff(paste0('hallamrks_immune_only_Hmap_kmeans_k','_clusters.tiff'),width=2000,height=3000,res=300)
draw(hlist,cluster_rows=FALSE, row_dend_reorder = TRUE,show_row_dend = FALSE)
hlist <- h1
tiff(paste0('hallamrks_immune_only_Hmap_kmeans_k','_clusters.tiff'),width=2000,height=3000,res=300)
draw(hlist,cluster_rows=TRUE, row_dend_reorder = TRUE,show_row_dend = FALSE)
dev.off()
h1<-Heatmap(as.matrix(highly_variable_lcpm[,1:(ncol(highly_variable_lcpm))]),cluster_rows=TRUE,cluster_columns=TRUE,use_raster=FALSE,row_dend_reorder = TRUE,show_row_dend = FALSE,column_split=factor(c(rep('RH_C13',6),rep('RH_C7',6), rep("RH30_P", 6)),levels=c('RH_C13','RH_C7','RH_HD', 'RH30_P')),show_row_names=TRUE,show_column_names = FALSE, heatmap_legend_param = list(title = "Z-score"))
hlist <- h1
tiff(paste0('hallamrks_immune_only_Hmap_kmeans_k','_clusters.tiff'),width=2000,height=3000,res=300)
